package passworks.Gates;

import passworks.*;

public class AND extends GateBase {

    public AND(int id) {

        /*
         * Ez majd kelleni fog az ID-khez
         */
        super(id);
        
        className = "AND";

        Logger.Print(className, className, Direction.IN, ownID);
        Logger.Print(className, className, Direction.OUT, ownID);

    }

    public void SetOutputs() {
        Logger.Print(className, "SetOutputs", Direction.IN, ownID);

         /*
          * Tenyleges logika
         */
        Logger.Print(className, "SetOutputs", Direction.OUT, ownID);
        for(Wire w : input)
        {
            if(w.GetState()==false)

            {
                output.get(0).SetState(false);
                return;
            }
        }
        output.get(0).SetState(true);        
    }
}
